package com.example.demo.service;

import com.example.common.entity.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.mapper.ArticleMapper;
import com.example.demo.mapper.UserMapper;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private ArticleMapper articleMapper;

    public Integer reg(UserInfo userInfo) {
        return userMapper.reg(userInfo);
    }

    public UserInfo getUserByName(String username) {
        return userMapper.getUserByName(username);
    }

    public Integer getArtCountByUid(Integer uid) {
        return articleMapper.getArtCountByUid(uid);
    }

    public UserInfo getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    public Integer updateStateByName(String username, Integer state) {
        return userMapper.updateStateByName(username, state);
    }

    public Integer getStateByName(String username) {
        return userMapper.getStateByName(username);
    }

    public Integer updatePhotoById(Integer id, String photo) {
        return userMapper.updatePhotoById(id, photo);
    }

    public Integer updateUserInfoById(UserInfo userInfo) {
        return userMapper.updateUserInfoById(userInfo);
    }


}
